package com.zzq.consumer;

import com.zzq.mapper.BidderInfoMapper;
import com.zzq.pojo.BidInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
@RocketMQMessageListener(
        consumerGroup = "${rocketmq.consumer.group}",
        topic = "${rocketmq-topic.bidding}",
        selectorExpression = "BIDDING_TAG"
)
public class BiddingConsumer implements RocketMQListener<BidInfo> {

    private final BidderInfoMapper bidderInfoMapper;

    @Override
    public void onMessage(BidInfo biddingInfo) {
        // 处理接收到的投标信息
        log.info("收到投标信息: {}" ,biddingInfo);

        // 业务处理逻辑...
        bidderInfoMapper.add(biddingInfo);
    }
}